/*
* Copyright(c) 2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package mapper.event
{
	import flash.events.Event;
	
	/**
	 * 对象消息,参数是object,所以是一个公用的事件的
	 * @author Pelephone
	 */
	public class ObjectEvent extends Event
	{
		//消息参数
		private var _body:Object;
		
		public function ObjectEvent(type:String,obj:Object=null,bubbles:Boolean=false,cancelable:Boolean=false)
		{
			this._body = obj;
			super(type,bubbles,cancelable);
		}
		
		public function get data():Object
		{
			return _body;
		}
		
		//将数据转换整型
		public function get dataInt():int
		{
			return int(_body);
		}
		
		//将数据转换布尔
		public function get dataBool():Boolean
		{
			return Boolean(_body);
		}
		
		//将数据转换数值
		public function get dataNum():Number
		{
			return Number(_body);
		}
		
		//将数据转换字符型
		public function get dataStr():String
		{
			return String(_body);
		}
		
		//将数据转换数组型
		public function get dataArr():Array
		{
			return (_body as Array);
		}
	}
}